Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[puppy] Introduce a package for misc Dart CLI tools #335

Merged
merged 7 commits into from
Jan 10, 2025
Merged

[puppy] Introduce a package for misc Dart CLI tools #335

merged 7 commits into from
Jan 10, 2025

Conversation

kevmoo
Copy link
Member

@kevmoo kevmoo commented Jan 8, 2025

First tool: for_all_package_dirs to recursively run a command in every
directory that contains pubspec.yaml

@kevmoo kevmoo requested a review from devoncarew as a code owner January 8, 2025 23:18
@github-actions github-actions bot added package:corpus type-infra A repository infrastructure change or enhancement labels Jan 8, 2025
@kevmoo
Copy link
Member Author

kevmoo commented Jan 8, 2025

Will rebase once #334 lands!

@kevmoo kevmoo marked this pull request as draft January 8, 2025 23:18
Copy link

github-actions bot commented Jan 8, 2025

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

Coverage ✔️
File Coverage

This check for test coverage is informational (issues shown here will not fail the PR).

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

@kevmoo kevmoo changed the title puppy [puppy] Introduce a package for misc Dart CLI tools Jan 8, 2025
First tool: for_all_package_dirs to recursively run a command in every
directory that contains pubspec.yaml
@kevmoo kevmoo marked this pull request as ready for review January 8, 2025 23:34
@kevmoo
Copy link
Member Author

kevmoo commented Jan 8, 2025

CC @jakemac53 RE convo in chat

Copy link
Member

@devoncarew devoncarew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some high level comments:

  • we may want a single entry-point here - to use puppy <command> and the package:args CommandRunner stuff
  • we may also want to leverage the pkgs convention - to not traverse into subdirectories arbitrarily
  • instead of an arbitrary 'run anything' command, should we instead have specific pub get / ... other commands?
  • if we do have a 'run anything' command, we'd probably want a shorter name than for_all_package_dirs; perhaps map (for map-reduce)?

@kevmoo
Copy link
Member Author

kevmoo commented Jan 9, 2025

Some high level comments:

  • we may want a single entry-point here - to use puppy <command> and the package:args CommandRunner stuff

Maybe? I lean towards specific top-level CLIs. They autocomplete where subcommands don't. Unless you have auto-complete magic installed.

  • we may also want to leverage the pkgs convention - to not traverse into subdirectories arbitrarily

I have cases where the package is NOT set up that way. I guess we could add a depth option or similar?

  • instead of an arbitrary 'run anything' command, should we instead have specific pub get / ... other commands?

Disagree. It's super nice to be able to run anything. Like dart run build_runner or similar

  • if we do have a 'run anything' command, we'd probably want a shorter name than for_all_package_dirs; perhaps map (for map-reduce)?

Agreed if we go w/ the one top-level thingy

@devoncarew
Copy link
Member

devoncarew commented Jan 9, 2025

  • we may want a single entry-point here - to use puppy <command> and the package:args CommandRunner stuff

Maybe? I lean towards specific top-level CLIs. They autocomplete where subcommands don't. Unless you have auto-complete magic installed.

I'd prefer a single entry-point - I think it scales better as we get more commands - but it's not a blocker for me.

  • we may also want to leverage the pkgs convention - to not traverse into subdirectories arbitrarily

I have cases where the package is NOT set up that way. I guess we could add a depth option or similar?

Can we just not support those repos? Or encourage the //pkgs/ convention?

I'm just hesitant of arbitrary recursion, and supporting nesting of nesting. Perhaps we stop looking after we've hit a pubspec dir? Or do that by default and have a flag to just keep going.

  • instead of an arbitrary 'run anything' command, should we instead have specific pub get / ... other commands?

Disagree. It's super nice to be able to run anything. Like dart run build_runner or similar

OK, makes sense.

  • if we do have a 'run anything' command, we'd probably want a shorter name than for_all_package_dirs; perhaps map (for map-reduce)?

Agreed if we go w/ the one top-level thingy

I like map :) But that's bikeshedding.

@jakemac53
Copy link
Contributor

I'm just hesitant of arbitrary recursion, and supporting nesting of nesting. Perhaps we stop looking after we've hit a pubspec dir? Or do that by default and have a flag to just keep going.

We should probably at least support example dirs, although if this is just for our own tooling then it might not really matter, because we don't really use that pattern outside of flutter.

@kevmoo
Copy link
Member Author

kevmoo commented Jan 10, 2025

How about default to no recursing deeper than the first discovered pubspec – unless you opt in

In my experience, it rarely causes issues...just (often) failures

@kevmoo kevmoo merged commit 25c57b8 into main Jan 10, 2025
14 checks passed
@kevmoo kevmoo deleted the puppy branch January 10, 2025 21:42
}
}

@CliOptions(createCommand: true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to pipe through command aliases here? If we wanted to instead support puppy run?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh crap! I forgot! Just submit a PR to change that now.

copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Jan 23, 2025
Revisions updated by `dart tools/rev_sdk_deps.dart`.

core (https://github.com/dart-lang/core/compare/7a71ad6..72a2060):
  72a20603  2025-01-17  Nate Bosch  Remove sorting of allowedHelp maps (dart-lang/core#852)
  a59cbeaf  2025-01-13  Kevin Moore  [os_detect] move to pkg:web, prepare publish (dart-lang/core#850)
  48c3c458  2025-01-13  Kevin Moore  [path] fix tests to compile/run with wasm (dart-lang/core#851)
  2ac228bd  2025-01-09  Devon Carew  update lint issue templates (dart-lang/core#849)
  513fa2f0  2025-01-08  Devon Carew  fix a line break issue in the package table (dart-lang/core#846)
  eb74f032  2025-01-06  Devon Carew  Update package:collection for the new `strict_top_level_inference` lint (dart-lang/core#735)

ecosystem (https://github.com/dart-lang/ecosystem/compare/efe4ee4..682c8ef):
  682c8ef  2025-01-17  Moritz  Update `dart_apitool` version in health workflow. (dart-lang/ecosystem#338)
  94b4cea  2025-01-14  Kevin Moore  [puppy] actually rename command to `run`, sort directories, better logs (dart-lang/ecosystem#337)
  f2d3178  2025-01-10  Devon Carew  rename the 'map' command to 'run' (dart-lang/ecosystem#336)
  25c57b8  2025-01-10  Kevin Moore  [puppy] Introduce a package for misc Dart CLI tools (dart-lang/ecosystem#335)
  21e81c5  2025-01-08  Kevin Moore  [corpus] update to latest analyzer, bump min SDK (dart-lang/ecosystem#334)

http (https://github.com/dart-lang/http/compare/6ecd13a..27184eb):
  27184eb  2025-01-21  Brian Quinlan  Remove bespoke code that handled blocking callbacks (dart-lang/http#1450)
  7271367  2025-01-20  Kevin Moore  [http] prepare v1.3.0 release (dart-lang/http#1451)
  7f50fc5  2025-01-15  Brian Quinlan  Prepare cupertino_http 2.0.2 for release (dart-lang/http#1449)
  2bc4cc9  2025-01-15  Brian Quinlan  Fix incorrect response processing (dart-lang/http#1448)
  531d3e5  2025-01-09  Kevin Moore  [http2, conformance_tests] update dependencies (dart-lang/http#1443)
  f0bcf02  2025-01-06  Brian Quinlan  Add tests to verify NUL, CR & LF header value behavior (dart-lang/http#1440)

test (https://github.com/dart-lang/test/compare/f364fc8..7fc9521):
  7fc95218  2025-01-17  Nate Bosch  Drop reference to legacy communication protocol (dart-lang/test#2446)
  073ef8bd  2025-01-17  Matan Lurey  Fix a type error that occurs comparing two large maps with `deepEquals`. (dart-lang/test#2442)
  b5bfba54  2025-01-17  Nate Bosch  Unblock CI: Ignore deprecation and skip a test (dart-lang/test#2445)

web (https://github.com/dart-lang/web/compare/af5de5e..fd3d988):
  fd3d988  2025-01-14  KennethHung  Adapt paths for different development environments (dart-lang/web#336)
  7f440e4  2025-01-10  KennethHung  Remove renames where the type doesn't exist anymore (dart-lang/web#334)
  3b06da9  2025-01-09  KennethHung  Add missing FileReader event getters (dart-lang/web#333)

webdev (https://github.com/dart-lang/webdev/compare/e72f365..4a92ba5):
  4a92ba58  2025-01-13  Ben Konyi  [ DWDS ] Reset version to 24.3.3-wip (dart-lang/webdev#2569)
  cc5aff69  2025-01-10  Ben Konyi  [ DWDS ] Relax DDS constraint, prepare for 24.3.2 release
  562ab622  2025-01-10  Ben Konyi  [ DWDS ] Reset version to 24.3.2-wip
  a7c8fe76  2025-01-10  Ben Konyi  Allow for setting custom DDS port (dart-lang/webdev#2546)
  7dc5c3a9  2025-01-09  Ben Konyi  Rename copied SDK directory prefix from 'sdk copy' to 'sdk_copy' (dart-lang/webdev#2557)
  659e1dfc  2025-01-08  Jessy Yameogo  Added support for some debugging APIs with the DDC library bundle format - part 5 (dart-lang/webdev#2549)
  fcd906fc  2025-01-07  Srujan Gaddam  Add ignores for deprecated web libraries with a TODO and move dwds to 24.4.0-wip (dart-lang/webdev#2559)

Change-Id: I3e847d24146bfb6891e77098591b785a0d15a445
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405243
Auto-Submit: Devon Carew <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Jan 23, 2025
This reverts commit a1e5451.

Reason for revert: it looks like golem is broken

Original change's description:
> [deps] rev core, ecosystem, http, test, web, webdev
>
> Revisions updated by `dart tools/rev_sdk_deps.dart`.
>
> core (https://github.com/dart-lang/core/compare/7a71ad6..72a2060):
>   72a20603  2025-01-17  Nate Bosch  Remove sorting of allowedHelp maps (dart-lang/core#852)
>   a59cbeaf  2025-01-13  Kevin Moore  [os_detect] move to pkg:web, prepare publish (dart-lang/core#850)
>   48c3c458  2025-01-13  Kevin Moore  [path] fix tests to compile/run with wasm (dart-lang/core#851)
>   2ac228bd  2025-01-09  Devon Carew  update lint issue templates (dart-lang/core#849)
>   513fa2f0  2025-01-08  Devon Carew  fix a line break issue in the package table (dart-lang/core#846)
>   eb74f032  2025-01-06  Devon Carew  Update package:collection for the new `strict_top_level_inference` lint (dart-lang/core#735)
>
> ecosystem (https://github.com/dart-lang/ecosystem/compare/efe4ee4..682c8ef):
>   682c8ef  2025-01-17  Moritz  Update `dart_apitool` version in health workflow. (dart-lang/ecosystem#338)
>   94b4cea  2025-01-14  Kevin Moore  [puppy] actually rename command to `run`, sort directories, better logs (dart-lang/ecosystem#337)
>   f2d3178  2025-01-10  Devon Carew  rename the 'map' command to 'run' (dart-lang/ecosystem#336)
>   25c57b8  2025-01-10  Kevin Moore  [puppy] Introduce a package for misc Dart CLI tools (dart-lang/ecosystem#335)
>   21e81c5  2025-01-08  Kevin Moore  [corpus] update to latest analyzer, bump min SDK (dart-lang/ecosystem#334)
>
> http (https://github.com/dart-lang/http/compare/6ecd13a..27184eb):
>   27184eb  2025-01-21  Brian Quinlan  Remove bespoke code that handled blocking callbacks (dart-lang/http#1450)
>   7271367  2025-01-20  Kevin Moore  [http] prepare v1.3.0 release (dart-lang/http#1451)
>   7f50fc5  2025-01-15  Brian Quinlan  Prepare cupertino_http 2.0.2 for release (dart-lang/http#1449)
>   2bc4cc9  2025-01-15  Brian Quinlan  Fix incorrect response processing (dart-lang/http#1448)
>   531d3e5  2025-01-09  Kevin Moore  [http2, conformance_tests] update dependencies (dart-lang/http#1443)
>   f0bcf02  2025-01-06  Brian Quinlan  Add tests to verify NUL, CR & LF header value behavior (dart-lang/http#1440)
>
> test (https://github.com/dart-lang/test/compare/f364fc8..7fc9521):
>   7fc95218  2025-01-17  Nate Bosch  Drop reference to legacy communication protocol (dart-lang/test#2446)
>   073ef8bd  2025-01-17  Matan Lurey  Fix a type error that occurs comparing two large maps with `deepEquals`. (dart-lang/test#2442)
>   b5bfba54  2025-01-17  Nate Bosch  Unblock CI: Ignore deprecation and skip a test (dart-lang/test#2445)
>
> web (https://github.com/dart-lang/web/compare/af5de5e..fd3d988):
>   fd3d988  2025-01-14  KennethHung  Adapt paths for different development environments (dart-lang/web#336)
>   7f440e4  2025-01-10  KennethHung  Remove renames where the type doesn't exist anymore (dart-lang/web#334)
>   3b06da9  2025-01-09  KennethHung  Add missing FileReader event getters (dart-lang/web#333)
>
> webdev (https://github.com/dart-lang/webdev/compare/e72f365..4a92ba5):
>   4a92ba58  2025-01-13  Ben Konyi  [ DWDS ] Reset version to 24.3.3-wip (dart-lang/webdev#2569)
>   cc5aff69  2025-01-10  Ben Konyi  [ DWDS ] Relax DDS constraint, prepare for 24.3.2 release
>   562ab622  2025-01-10  Ben Konyi  [ DWDS ] Reset version to 24.3.2-wip
>   a7c8fe76  2025-01-10  Ben Konyi  Allow for setting custom DDS port (dart-lang/webdev#2546)
>   7dc5c3a9  2025-01-09  Ben Konyi  Rename copied SDK directory prefix from 'sdk copy' to 'sdk_copy' (dart-lang/webdev#2557)
>   659e1dfc  2025-01-08  Jessy Yameogo  Added support for some debugging APIs with the DDC library bundle format - part 5 (dart-lang/webdev#2549)
>   fcd906fc  2025-01-07  Srujan Gaddam  Add ignores for deprecated web libraries with a TODO and move dwds to 24.4.0-wip (dart-lang/webdev#2559)
>
> Change-Id: I3e847d24146bfb6891e77098591b785a0d15a445
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405243
> Auto-Submit: Devon Carew <[email protected]>
> Reviewed-by: Konstantin Shcheglov <[email protected]>
> Commit-Queue: Konstantin Shcheglov <[email protected]>

Change-Id: I27c20ef89095a7d602c1a609d5533a27a7683a47
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405445
Commit-Queue: Konstantin Shcheglov <[email protected]>
Auto-Submit: Devon Carew <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
Bot-Commit: Rubber Stamper <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-infra A repository infrastructure change or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants